home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_gen_playambient2.cog < prev    next >
Text File  |  1999-11-15  |  2KB  |  99 lines

  1. # Jones 3D Cog Script
  2. #
  3. # gen_PlayAmbient2.cog
  4. #
  5. # Plays a sound at a one or more locations. The cog can be switched on and off by entering
  6. # various sectors.
  7. #
  8. # [SXC]
  9. #
  10. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  11. # ========================================================================================
  12.  
  13. symbols
  14.     message    entered
  15.  
  16.     sector    turnon1        linkid=1       // turn sound on
  17.     sector    turnon2        linkid=1
  18.     sector    turnon3        linkid=1
  19.  
  20.     sector    turnoff1        linkid=2    // turn sound off
  21.     sector    turnoff2        linkid=2
  22.     sector    turnoff3        linkid=2
  23.  
  24.     thing        soundPos0        nolink
  25.     thing        soundPos1        nolink
  26.     thing        soundPos2        nolink
  27.     thing        soundPos3        nolink
  28.     thing        soundPos4        nolink
  29.     thing        soundPos5        nolink
  30.     thing        soundPos6        nolink
  31.     thing        soundPos7        nolink
  32.  
  33.     sound        wav0
  34.  
  35.     float        minDist=-1
  36.     float        maxDist=-1
  37.     float        vol=1.0
  38.  
  39.     int        cnt=-1        local
  40.     int        soundnum0=0        local
  41.     int        soundnum1=0        local
  42.     int        soundnum2=0        local
  43.     int        soundnum3=0        local
  44.     int        soundnum4=0        local
  45.     int        soundnum5=0        local
  46.     int        soundnum6=0        local
  47.     int        soundnum7=0        local
  48.     int        soundon=0        local
  49.  
  50. # subroutines
  51. flex    turnsoundon=0.0        local
  52. flex    turnsoundoff=0.0    local
  53. end
  54.  
  55. code
  56.  
  57. # ........................................................................................
  58.  
  59. entered:
  60.     if (GetSenderID() == 1)
  61.     {
  62.         call turnsoundon;
  63.     } else {
  64.         call turnsoundoff;
  65.     }
  66.     return;
  67.  
  68. # ........................................................................................
  69.  
  70. turnsoundon:
  71.     if (soundon) return;
  72.     soundon = 1;
  73.     for (cnt = 0; cnt <= 7; cnt = cnt+1)
  74.     {
  75.         // flags indicate looping & ambient
  76.         if (soundPos0[cnt] >= 0)
  77.         {
  78.             soundnum0[cnt] = PlaySoundThing(wav0, soundPos0[cnt], vol, minDist, maxDist, 0x045);
  79.         }
  80.     }
  81.     return;
  82.  
  83. # ........................................................................................
  84.  
  85. turnsoundoff:
  86.     soundon = 0;
  87.     for (cnt = 0; cnt <= 7; cnt = cnt+1)
  88.     {
  89.         // flags indicate looping & ambient
  90.         if (soundPos0[cnt] >= 0)
  91.         {
  92.             StopSound(soundnum0[cnt], 0);
  93.         }
  94.     }
  95.     return;
  96.  
  97. end
  98.  
  99.